onInflate
Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity. This may be called immediately after the fragment is created from a FragmentContainerView in a layout file. Note this is before the fragment's onAttach has been called; all you should do here is parse the attributes and save them away.
This is called the first time the fragment is inflated. If it is being inflated into a new instance with saved state, this method will not be called a second time for the restored state fragment.
Here is a typical implementation of a fragment that can take parameters both through attributes supplied here as well from getArguments:
{@sample samples/Support4Demos/src/main/java/com/example/android/supportv4/app/FragmentArgumentsSupport.java * fragment}Note that parsing the XML attributes uses a "styleable" resource. The declaration for the styleable used here is:
{@sample samples/Support4Demos/src/main/res/values/attrs.xml fragment_arguments}The fragment can then be declared within its activity's content layout through a tag like this:
{@sample samples/Support4Demos/src/main/res/layout/fragment_arguments_support.xml from_attributes}This fragment can also be created dynamically from arguments given at runtime in the arguments Bundle; here is an example of doing so at creation of the containing activity:
{@sample samples/Support4Demos/src/main/java/com/example/android/supportv4/app/FragmentArgumentsSupport.java * create}Parameters
The Activity that is inflating this fragment.
The attributes at the tag where the fragment is being created.
If the fragment is being re-created from a previous saved state, this is the state.
Deprecated
See onInflate.
Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity.